/*=============================================================================

  MAIN VIEW
  
  FILE: Vmain.h
  
  DESCRIPTION

    Module for Application

  EXTERNALIZED FUNCTIONS

    
  Copyright (c) DaeSung Engineering Inc. All rights reserved.

=============================================================================*/
/*=============================================================================

                             EDIT HISTORY

  ---------  -------  -------------------------------------------------------
    when       who     what, where, why
  ---------  -------  -------------------------------------------------------
   05/26/05   pkim    Version E01.0

=============================================================================*/

#ifndef _VMAIN_H_
#define _VMAIN_H_

/*=============================================================================
  HEADER INCLUSION
=============================================================================*/
#include <Cust_AppDef.h>
#include <GImgVw.h>

/*=============================================================================
  CONSTANT DEFINITION
=============================================================================*/
typedef enum
{
	//-----------------------------------------------------
	// READ
	//  * RD = DWORD, RW = WORD
	//-----------------------------------------------------
	TEST_BASE_READ = 0x00,
	TEST_1_RD = TEST_BASE_READ,
	TEST_2_RD,
	TEST_3_RD,
	TEST_4_RD,
	TEST_5_RD,

	TEST_END_READ = TEST_5_RD,
} HTEST_Map_e;
/*=============================================================================
  ENUMERATORS
=============================================================================*/

/*=============================================================================
  STRUCTURE DEFINITION
=============================================================================*/
#define TESTMEM_BASE_READ				(50) // Read base memory address

typedef struct
{
	dword		no;
	dword		cell;
	byte			gate;
	char			data[16];
	double64		size1;
	double64		size2;
	double64		size3;
	char			code1[16];
	char			code2[16];
	char			code3[16];

	// Value
	dword		req_val;
	dword		cur_val;
} test_map_s, *TESTMAP;

static test_map_s	testMap[] = \
{  
	{TEST_1_RD, TESTMEM_BASE_READ+0, 5, "A1", 1.0, 3.3, 10.4, "test #1", "test #9", "test #3"},
	{TEST_2_RD, TESTMEM_BASE_READ+8, 2, "B2", 5.5, 4.3, 20.0, "test #2", "test #3", "test #5"},
	{TEST_3_RD, TESTMEM_BASE_READ+3, 7, "C3", 6.8, 7.6, 34.2, "test #3", "test #8", "test #4"},
	{TEST_4_RD, TESTMEM_BASE_READ+6, 3, "D4", 7.2, 2.7, 1.7, "test #4", "test #7", "test #7"},
	{TEST_5_RD, TESTMEM_BASE_READ+1, 8, "E5", 4.3, 7.2, 4.3, "test #5", "test #1", "test #6"},
};
/*=============================================================================
  CLASS FUNCTION DEFINITION
=============================================================================*/
class Vmain : public CWnd
{
public:
	Vmain();
	virtual ~Vmain();

public:
/*---------------------------------------------------------
  BASIC MEMBERS
---------------------------------------------------------*/
public:
	BOOL WindowCreate(const char *szTitle, int x, int y, \
						int w, int h, BYTE nStyle, CWnd *pParent);

	DWORD Event_Handler(DWORD dwType, DWORD dwEvent, DWORD wParam, DWORD lParam);
	void UI_SYNC(boolean toUI);

	boolean				m_lBtn;
	LONG				m_px, m_py, m_nx, m_ny;
	Img2D				m_cImg, m_nImg;
	
protected:
	void InitItem(void);
	void CloseItem(void);

/*---------------------------------------------------------
  CHILD VIEWS
-----------------------------------------------------------*/
public:
	GImgVw			m_vwImg;
	GText			m_vwTitle; // Title
	GListCtrl			m_mList;
	
	void VW_CREATE(void);
	void VW_DESTROY(void);
	void *IMGget(void);

	void LISTchange(LONG mapStart, LONG mapEnd, COLORREF col, boolean scroll);

protected:
	CFont			m_listFont, m_headFont;

	void LISTcreate(int32 x, int32 y, int32 w, int32 h);
	void LISTdestroy(void);
	void LISTclear(void);
	void LISTscroll(int32 no);
	void LISTadd(test_map_s *m);

/*---------------------------------------------------------
  AFX MESSAGE HANDLER
-----------------------------------------------------------*/
protected:
	DECLARE_MESSAGE_MAP()
public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
	virtual void PostNcDestroy();
public:
	afx_msg void OnDestroy();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	LRESULT MSG_ListFunc(WPARAM wParam, LPARAM lParam);
};

#endif /* _VMAIN_H_ */

/*--- END OF Vmain.H ---*/
